Skip to main content

Deploy All Views

πŸ“„ <ENV> - [BigQuery] Deploy all views​

This GitHub Actions workflow allows developers to deploy all BigQuery views in bulk from a designated directory. It loops through each TypeScript view definition file and runs it using ts-node.


πŸ“Œ Workflow Trigger​

This workflow is triggered manually via the GitHub actions from functions repo.


πŸ’  Environment Variables​

VariableDescription
GCP_PROJECT_IDGCP Project ID (e.g., biddirect-2)

🧱️ Workflow Job: deploy-bigquery-views​

StepDescription
Checkout repositoryClones the GitHub repository to the runner.
Set project env variableStores GCP_PROJECT_ID as a GitHub environment variable.
Authenticate with GCPUses the <ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT secret to authenticate.
Set up Cloud SDKInstalls and configures the Google Cloud SDK CLI.
Install dependenciesInstalls Node.js dependencies in the functions directory.
Deploy all BigQuery viewsLoops through all .ts files in the views directory and executes each using ts-node.

🧹 View Scripts Directory​

All BigQuery view scripts must be placed in:

functions/src/bqDataLake/definitions/views/

Each .ts file should contain the logic necessary to deploy its respective view to BigQuery.

Example:

functions/src/bqDataLake/definitions/views/accounts_latest_view.ts
functions/src/bqDataLake/definitions/views/accounts_serviceUnit_latest_view.ts

πŸ” Required Secrets​

Secret NameDescription
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNTService account key JSON for GCP auth.

βœ… Example Usage​

To run this workflow:

  1. Navigate to the Actions tab in your GitHub repository.
  2. Select <ENV> - [BigQuery] Deploy all views.
  3. Click "Run workflow".

This will:

  • Authenticate with GCP
  • Loop through all view scripts in the target directory
  • Deploy each BigQuery view by executing its script using ts-node

This workflow simplifies the process of updating all BigQuery views in development and ensures all definitions are consistently deployed.